<#include "/layout/header.ftl" />

<script>
$(function()
{
	$.upload(
	{
		button: "#btn_upload",
		url: "/admin/upload_file",
		param: {type: 1},
		result: function(up, file, o)
		{
			var data = o;
			$("img.bl_big_avatar").attr("src", data.url);
		}
	});
});

function edit_click()
{
	$("#div_preview").hide();
	$("#btn_edit").hide();
	$("#btn_return").hide();
	$("#div_edit").show();
	$("#btn_save").show();
}

function cancel_click()
{
	$("#div_preview").show();
	$("#btn_edit").show();
	$("#btn_return").show();
	$("#div_edit").hide();
	$("#btn_save").hide();
}

function save_click()
{
	var obj = $.getObject("#div_edit");
	$.simpleAjax("/admin/info/edit", obj, function(o)
	{
		$.toast("修改成功", function()
		{
			window.location = "${path}/admin/info/index";
		});
	});
}
</script>

<div class="weui-form-preview" id="div_preview">
	<#if user.picUrl??>
		<img class="bl_big_avatar" src="${user.picUrl}" />
	<#else>
		<img class="bl_big_avatar" src="${rc_path}/images/user.jpg" />
	</#if>

	<div class="weui-form-preview__bd">
		<div class="weui-form-preview__item">
			<label class="weui-form-preview__label">手机号</label>
			<span class="weui-form-preview__value">${user.mobile!}</span>
		</div>
		<div class="weui-form-preview__item">
			<label class="weui-form-preview__label">昵称</label>
			<span class="weui-form-preview__value">${user.nickname!}</span>
		</div>
		<div class="weui-form-preview__item">
			<label class="weui-form-preview__label">E-Mail</label>
			<span class="weui-form-preview__value">${user.email!}</span>
		</div>
		<div class="weui-form-preview__item">
			<label class="weui-form-preview__label">注册时间</label>
			<span class="weui-form-preview__value">${(user.createTime?datetime)!}</span>
		</div>
		<div class="weui-form-preview__item">
			<label class="weui-form-preview__label">登录时间</label>
			<span class="weui-form-preview__value">${(user.loginTime?datetime)!}</span>
		</div>
	</div>
</div>

<div class="weui-cells weui-cells_form" id="div_edit" style="display: none;">
	<#if user.picUrl??>
		<img class="bl_big_avatar" src="${user.picUrl}" />
	<#else>
		<img class="bl_big_avatar" src="${rc_path}/images/user.jpg" />
	</#if>

	<!--
	<div class="weui-cell">
		<div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
		<div class="weui-cell__bd">
			<input type="text" class="weui-input" value="${user.mobile!}" readonly>
		</div>
	</div>
	-->
	<div class="weui-cell">
		<div class="weui-cell__hd"><label class="weui-label">昵称</label></div>
		<div class="weui-cell__bd">
			<input type="text" name="nickname" class="weui-input" maxlength="20" value="${user.nickname!}" />
		</div>
	</div>
	<div class="weui-cell">
		<div class="weui-cell__hd"><label class="weui-label">E-Mail</label></div>
		<div class="weui-cell__bd">
			<input type="text" name="email" class="weui-input" maxlength="200" value="${user.email!}" />
		</div>
	</div>
	<!--
	<div class="weui-cell">
		<div class="weui-cell__hd"><label class="weui-label">注册时间</label></div>
		<div class="weui-cell__bd">
			<input type="text" class="weui-input" value="${(user.createTime?datetime)!}" readonly>
		</div>
	</div>
	<div class="weui-cell">
		<div class="weui-cell__hd"><label class="weui-label">登录时间</label></div>
		<div class="weui-cell__bd">
			<input type="text" class="weui-input" value="${(user.loginTime?datetime)!}" readonly>
		</div>
	</div>
	-->
</div>

<div class="weui-flex flex_padding" id="btn_save" style="display: none;">
	<div class="weui-flex__item">
		<a href="javascript:;" onclick="save_click()" class="weui-btn weui-btn_primary">保存</a>
	</div>
	<div class="weui-flex__item">
		<a href="javascript:;" onclick="cancel_click()" class="weui-btn weui-btn_plain-default">取消</a>
	</div>
</div>

<div class="upload">
	<a id="btn_upload" href="javascript:;"><li class="fa fa-upload fa-2x ico_white"></li></a>
</div>

<div class="edit" id="btn_edit">
	<a href="javascript:;" onclick="edit_click()"><li class="fa fa-edit fa-2x ico_white"></li></a>
</div>
<div class="return" id="btn_return">
	<a href="${path}/admin/index"><li class="fa fa-arrow-left fa-2x ico_white"></li></a>
</div>

<#include "/layout/footer.ftl" />